<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>图书管理</title>
<%--	<%--%>
<%--		String Scheme = request.getScheme();--%>
<%--		String ServerName = request.getServerName();--%>
<%--		int ServerPort = request.getServerPort();--%>
<%--		String contextpath = request.getContextPath();--%>
<%--		String servletPath = request.getServletPath();--%>
<%--		String str = Scheme+"://"+ServerName+":"+ServerPort+contextpath;--%>
<%--	%>--%>
<%--	<base href=<%=str%>>--%>

	<base href="http://localhost:8080/book/">
<link type="text/css" rel="stylesheet" href="项目/static/css/style.css" >
	<script src="项目/static/script/jquery-1.7.2.js"></script>
	<script type="text/javascript">
		$(
				function () {
					$("#exitClass").click(function () {
					var $v = $(this);
					var td = $v.parent().parent().find(":first").text();
						return confirm("确定要删除["+td+"]吗?");
					})
				}
		);

	</script>

</head>
<body>

	<div id="header">
			<img class="logo_img" alt="" src="项目/static/img/logo.gif" >
			<span class="wel_word">图书管理系统</span>
		<%@include file="/项目/pages/quote/menu.jsp"%>
	</div>

	<div id="main">
		<table>

			<tr>
				<td>名称</td>
				<td>价格</td>
				<td>作者</td>
				<td>销量</td>
				<td>库存</td>
				<td colspan="2">操作</td>
			</tr>
			<c:forEach items="${requestScope.page.items}" var="book">

				<tr>
					<td>${book.name}</td>
					<td>${book.price}</td>
					<td>${book.author}</td>
					<td>${book.sales}</td>
					<td>${book.stock}</td>
<%--					<td><a href="项目/pages/manager/book_edit.jsp">修改</a></td>--%>
					<td><a href="manager/bookServlet?action=getBook&id=${book.id}&pageNo=${requestScope.page.pageNo}">修改</a></td>
					<td><a id="exitClass" href="manager/bookServlet?action=delete&id=${book.id}&pageNo=${requestScope.page.pageNo}">删除</a></td>
				<tr/>

			</c:forEach>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td><a href="项目/pages/manager/book_edit.jsp">添加图书</a></td>
			</tr>
		</table>
<%--		--%>
<%--		<div id="page_nav">--%>
<%--            <c:if test="${requestScope.page.pageNo>1}">--%>
<%--                <a href="manager/bookServlet?action=page&pageNo=1">首页</a>--%>
<%--                <a href="manager/bookServlet?action=page&pageNo=${page.pageNo-1}">上一页</a>--%>
<%--            </c:if>--%>
<%--<c:choose>--%>
<%--&lt;%&ndash;    //总页数在5页内 全部显示&ndash;%&gt;--%>
<%--    <c:when test="${requestScope.page.pageTotal<=5}">--%>
<%--        <c:set var="begin" value="1"/>--%>
<%--        <c:set var="end" value="${requestScope.page.pageTotal}"/>--%>
<%--    </c:when>--%>
<%--    &lt;%&ndash;    //总页大于5页 &ndash;%&gt;--%>
<%--    <c:when test="${requestScope.page.pageTotal>5}">--%>
<%--        <c:choose>--%>
<%--            &lt;%&ndash;        总页大于5页  小情况1:当前页面为前三个 页码范围在1-5&ndash;%&gt;--%>
<%--            <c:when test="${requestScope.page.pageNo<=3}">--%>
<%--                <c:set var="begin" value="1"/>--%>
<%--                <c:set var="end" value="5"/>--%>
<%--            </c:when>--%>
<%--            &lt;%&ndash;        总页大于5页  小情况2:当前页面为后三个 页码范围在最后1-5&ndash;%&gt;--%>
<%--            <c:when test="${requestScope.page.pageNo>requestScope.page.pageTotal-3}">--%>
<%--                <c:set var="begin" value="${requestScope.page.pageTotal-4}"/>--%>
<%--                <c:set var="end" value="${requestScope.page.pageTotal}"/>--%>
<%--            </c:when>--%>
<%--            &lt;%&ndash;        总页大于5页  小情况3:其余情况&ndash;%&gt;--%>
<%--            <c:otherwise>--%>
<%--                <c:set var="begin" value="${requestScope.page.pageNo-2}"/>--%>
<%--                <c:set var="end" value="${requestScope.page.pageNo+2}"/>--%>
<%--            </c:otherwise>--%>
<%--        </c:choose>--%>
<%--    </c:when>--%>
<%--</c:choose>--%>
<%--            <c:forEach begin="${begin}" end="${end}" var="b5" >--%>
<%--                <c:if test="${b5==requestScope.page.pageNo}">--%>
<%--                    [${b5}]--%>
<%--                </c:if>--%>
<%--                <c:if test="${requestScope.page.pageNo!=b5}">--%>
<%--                    ${b5}--%>
<%--                </c:if>--%>
<%--            </c:forEach>--%>
<%--          <c:if test="${requestScope.page.pageNo<requestScope.page.pageTotal}">--%>
<%--                <a href="manager/bookServlet?action=page&pageNo=${page.pageNo+1}">下一页</a>--%>
<%--                <a href="manager/bookServlet?action=page&pageNo=${page.pageTotal}">末页</a>--%>
<%--          </c:if>--%>
<%--			共${requestScope.page.pageTotal}页，${requestScope.page.pageTotalcount}条记录 到第<input value="${requestScope.page.pageNo}" name="pn" id="pn_input"/>页--%>
<%--			<input id="bottommm" type="button" value="确定">--%>
<%--            <script type="text/javascript">--%>
<%--                $(--%>
<%--                    function(){--%>
<%--                        $("#bottommm").click(function () {--%>
<%--                            var inp =  $("#pn_input").val();--%>
<%--                            location.href="http://localhost:8080/book/manager/bookServlet?action=page&pageNo="+inp;--%>
<%--                        })--%>
<%--                    }--%>
<%--                )--%>

<%--            </script>--%>
<%--		</div>--%>
<%--		--%>
	</div>
	<%@include file="/项目/pages/quote/pageModle.jsp"%>
	<%@include file="/项目/pages/quote/footer.jsp"%>
</body>
</html>